//index.js
//获取应用实例
const app = getApp()

Page({
    data: {
        "achtotal":{
            "kstotal":0,
            "srtotal":0
        },
        "menulist":[]
    },
    //事件处理函数
    bindViewTap: function () {

    },
    onLoad: function () {
        var _this=this;
        _this.GetMenuList();
        _this.GetBossAchievementConcise();
    },
    //获取老板的当月统计数据
    GetBossAchievementConcise: function () {
        var _this = this;
        app.http.POST('/MiniManagerAchievement/GetBossAchievementConcise',{},(err,data)=>{
            if(data.code==1){
                _this.setData({
                    "achtotal": {
                        "kstotal": data.data.ksTotal,
                        "srtotal": data.data.srTotal
                    }
                })
            } else if (data.code == 2) {
                wx.showToast({
                    title: data.msg,
                    icon: 'none',
                    duration: 2000
                })
            }
            else {
                wx.showToast({
                    title: '请求失败',
                    icon: 'none',
                    duration: 2000
                })
            }
        })
    },
    GetMenuList(){
        var _this = this;
        app.http.POST('/MiniCommon/GetMenuList', { 'moldType':'bosshome'}, (err, data) => {
            if (data.code == 1) {
                _this.setData({
                    "menulist":data.data
                })
            } else if (data.code == 2) {
                wx.showToast({
                    title: data.msg,
                    icon: 'none',
                    duration: 2000
                })
            }
            else {
                wx.showToast({
                    title: '请求失败',
                    icon: 'none',
                    duration: 2000
                })
            }
        })
    },
    //重链接
    reLink:function(e){
        var dataset = e.currentTarget.dataset;
        wx.navigateTo({
            url: dataset.url,
        })
    }
})
